import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { EvaluteSystemComponent } from './evalute-system.component';
import { RouterModule, Routes } from '@angular/router';
import { QuestionbankManageComponent } from './questionbank-manage/questionbank-manage.component';
import { LoginActivate } from '../../core/auth/login.activate';
import { NgZorroAntdModule } from 'ng-zorro-antd';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { ShareModule } from '../../share/share.module';
import { UMeditorModule } from 'ngx-umeditor';
import { RouteActivateChild } from '../../core/auth/route.activate.child';
import { CourseManageComponent } from './course-manage/course-manage.component';
import { QuestionbankManageTreeComponent } from './questionbank-manage-tree/questionbank-manage-tree.component';

const routes: Routes = [
  {
    path: '', component: EvaluteSystemComponent, children: [
      {
        path: 'questionbank-manage',
        component: QuestionbankManageComponent,
        data: {
          breadcrumb: '题库管理'
        },
        canActivate: [LoginActivate]
      },
      {
        path: 'evalute-form', loadChildren: './evalute-form-mng/evalute-form-mng.module#EvaluteFormMngModule',
        canActivateChild: [RouteActivateChild]
      },
      {
        path: 'course-manage',
        component: CourseManageComponent,
        data: {
          breadcrumb: '课程管理'
        },
        canActivate: [LoginActivate]
      },
      {
        path: '', redirectTo: 'questionbank-manage', pathMatch: 'full'
      },
      {
        path: '**', component: QuestionbankManageComponent
      }
    ]
  }
]

@NgModule({
  declarations: [
    EvaluteSystemComponent,
    QuestionbankManageComponent,
    CourseManageComponent,
    QuestionbankManageTreeComponent
  ],
  imports: [
    CommonModule,
    NgZorroAntdModule,
    FormsModule,
    ReactiveFormsModule,
    ShareModule,
    RouterModule.forChild(routes),
    UMeditorModule.forRoot(),
  ]
})
export class EvaluteSystemModule { }
